import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: '/login'
    },
    {
      path: '/login',
      component: () => import('@/views/login.vue')
    },
    {
      path: '/aaa',
      redirect: '/home',
      component: () => import('@/views/LayoutView.vue'),
      children: [
        {
          path: '/home',
          component: () => import('@/views/HomeView.vue')
        },
        {
          path: '/cart',
          component: () => import('@/views/CartView.vue')
        },
        {
          path: '/order',
          component: () => import('@/views/OrderView.vue')
        },
        {
          path: '/my',
          component: () => import('@/views/MyView.vue')
        },
        {
          path: `/my/address`,
          component: () => import('@/views/AddressView.vue')
        },
        {
          path: '/my/address/create',
          component: () => import('@/views/CreateAddressView.vue')
        }
      ]
    },
    {
      path: `/shop/:id`,
      name:'shop',
      component: () => import('@/views/ShopView.vue'),
    }
  ]
})

export default router
